/**
 * 医院快速增加
 * @author singwa
 */
var hospital = {
    add : function() {
        // 获取增加页面中的用户名 和 密码  测试
        var mc = $('input[name="mc"]').val();
        var dh = $('input[name="dh"]').val();
        var Signature = ($("input[type='checkbox']").is(':checked'));
        var yytm = $('#qy').val();
        var data = {'mc':mc,'dh':dh};
        var url = "/index.php/index/hospital/add";
        if(Signature){
            var data = {'mc':mc,'dh':dh,'Signature':Signature,'yytm':yytm};
        }
        // 执行异步请求  $.post
        $.post(url,data,function(result){
            if(result.status == 0) {
                return dialog.error(result.message);
            }
            if(result.status == 1) {

                 return  dialog.full(result.message);
                /*/!*return dialog.success(result.message, '/index.php/index/hostpital/index');*!/*/
            }

        },'JSON');

    },


    /**
     * 医院查询
     * @author singwa
     */

    read : function() {

        // 获取增加页面中的用户名 和 密码
        var dh = $('input[name="dh"]').val();
        var url = "/index.php/index/hospital/read";
        var data = {'dh':dh};
        // 执行异步请求  $.post
        $.post(url,data,function(result){
            if(result.status == 0) {
                return dialog.error(result.message);
            }
            if(result.status == 1) {
                return dialog.success(result.message, '/index.php/index/hostpital/edit',result.data);
                dh.val() == result.data.dh;

            }

        },'JSON');

    },

    /**
     * 医院删除
     * @author singwa
     */

    del:function(){
        var dh = $('input[name="dh"]').val();

        var url = "/index.php/index/hospital/DelHospital";
        var data = {'dh':dh};
        // 执行异步请求  $.post
        $.post(url,data,function(result){
            if(result.status == 0) {
                return dialog.full(result.message);
            }
            if(result.status == 1) {
                return dialog.full(result.message);
            }
        },'JSON');
    },

    /***
     * 医院添加签章 重新生成最近三天报告 cc
     */
    sign:function (){
        var dh = $('input[name="dh"]').val();

        var url = "/index.php/index/hospital/SignHospital";
        var data = {'dh':dh};
        // 执行异步请求  $.post
        $.post(url,data,function(result){
            if(result.status == 0) {
                return dialog.full(result.message);
            }
            if(result.status == 1) {
                return dialog.full(result.message);
            }
        },'JSON');
    }

}